﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SmartSpace.Web;

namespace SmartSpace.News.UI.Parts.Pages
{
    public partial class CreateCategory : SsPart
    {
        public CreateCategory()
            : base(new Guid("{502C6225-C8AD-4F90-BF13-AFBC5054E657}"))
        {

        }

        protected override void OnLoad(EventArgs e)
        {

        }

        protected void _ctlBtnSave_Click(object sender, EventArgs e)
        {
            NewsService service = new NewsService();

            Category category = new Category();
            category.Id = Guid.NewGuid();
            category.Code = _ctlCode.Text;
            category.Name = _ctlName.Text;
            category.Description = _ctrlDesc.Text;
            category.Creator = Page.User.Identity.Name;
            category.CreateDate = DateTime.Now;

            service.SaveCategory(category);
        }
    }
}